package com.base.vistter.iframe.utils;

import com.base.vistter.iframe.bean.SystemContextHolder;

import java.util.ArrayList;
import java.util.List;

public class ToolUtils {

    public static List<Integer> pathToList(String path) {
        List<Integer> result = new ArrayList<>();
        String[] paths = path.split(",");
        for (int i = 0; i < paths.length; i++) {
            result.add(Integer.parseInt(paths[i]));
        }
        return result;
    }

    /**
     * 判断是否超级管理员
     *
     * @return
     */
    public static boolean isAdmin() {
        return SystemContextHolder.getSessionContext().getIsAdmin() == 1;
    }

    /**
     * 业务管理员
     *
     * @return
     */
    public static boolean isBusAdmin() {
        return SystemContextHolder.getSessionContext().getIsAdmin() == 2;
    }

    public static boolean isNormalUser() {
        return SystemContextHolder.getSessionContext().getIsAdmin() == 0;
    }

}
